package com.wulwu.distributedoid;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author wuxb
 * @Date 2022/8/25 16:25
 */
@Configuration
@ConfigurationProperties(prefix = "snow")
public class SnowFlakeConfig {

    private long datacenterId;

    private long machineId;

    public long getDatacenterId() {
        return datacenterId;
    }

    public void setDatacenterId(long datacenterId) {
        this.datacenterId = datacenterId;
    }

    public long getMachineId() {
        return machineId;
    }

    public void setMachineId(long machineId) {
        this.machineId = machineId;
    }

    @Bean
    public SnowFlakeUtil snowFlakeUtil() {
        return new SnowFlakeUtil(datacenterId, machineId);
    }

}
